/*
 * @Author: atony2099
 * @Date: 2019-02-15 03:18:32
 * @Last Modified by: atony2099
 * @Last Modified time: 2019-02-15 07:47:20
 */

'use strict';

const moment = require('moment');

const crypto = require('crypto');
module.exports = {
  createMD5(content) {
    const md5 = crypto.createHash('md5');
    return md5.update(content).digest('hex');
  },
  isSameDay(d1, d2) {
    return moment(d1).diff(moment(d2), 'days') === 0;
  },
  isNearbyDate(d1, d2) {
    const nearybY = Math.abs(moment(d1).diff(moment(d2), 'days')) === 1;
    return nearybY;
  },
};
